package com.neusoft.ecommerce.service.impl;

import com.neusoft.ecommerce.dbhelper.LayuiPager;
import com.neusoft.ecommerce.dbhelper.Pager;
import com.neusoft.ecommerce.exception.EcommerceException;
import com.neusoft.ecommerce.mapper.SuperMapper;
import com.neusoft.ecommerce.service.SuperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 紫煦桉
 */
@Service
public abstract class AbstractSuperServiceImpl<T> implements SuperService<T> {
    private final SuperMapper<T> superMapper;

    @Autowired
    public AbstractSuperServiceImpl(SuperMapper<T> superMapper) {
        this.superMapper = superMapper;
    }

    @Override
    public List<T> findList(LayuiPager<T> pager) throws EcommerceException {
        return superMapper.findList(pager);
    }

    @Override
    public List<T> findAll() throws EcommerceException {
        return superMapper.findAll();
    }

    @Override
    public int findTotal(LayuiPager<T> pager) throws EcommerceException {
        return superMapper.findTotal(pager);
    }

    @Override
    public Boolean add(T param) throws EcommerceException {
        return superMapper.add(param);
    }

    @Override
    public Boolean edit(T param) throws EcommerceException {
        return superMapper.edit(param);
    }

    @Override
    public Boolean delete(T param) throws EcommerceException {
        return superMapper.delete(param);
    }
}
